﻿using System;
namespace Pixysoft.Framework.Noebe
{
    public interface INoebeSQLHelper
    {
        /// <summary>
        /// 获取自定义分页SQL
        /// </summary>
        /// <param name="sql"></param>
        /// <param name="pagingColumnName"></param>
        /// <param name="pageCapacity"></param>
        /// <param name="pageIndex"></param>
        /// <param name="reverse"></param>
        /// <returns></returns>
        string GetPagingSQL(string sql, string pagingColumnName, int pageCapacity, int pageIndex, bool reverse);

        /// <summary>
        /// 查看字段值是否有空 返回空值的个数
        /// </summary>
        /// <param name="tablename"></param>
        /// <param name="column"></param>
        /// <returns></returns>
        string GetColumnIsNullable(string tablename, string column);

        /// <summary>
        /// 查询字段值是否唯一 返回重复项的个数
        /// </summary>
        /// <param name="tablename"></param>
        /// <param name="columns"></param>
        /// <returns></returns>
        string GetColumnsIsUnique(string tablename, params string[] columns);

        /// <summary>
        /// 列举所有重复数据项
        /// </summary>
        /// <param name="tablename"></param>
        /// <param name="colname"></param>
        /// <returns></returns>
        string GetDuplicateData(string tablename, string colname);

        /// <summary>
        /// 表数据备份
        /// </summary>
        /// <param name="fromtablename"></param>
        /// <param name="totablename"></param>
        /// <returns></returns>
        string GetBackupData(string fromtablename, string totablename);
    }
}
